package com.gateway.common.enums;

/**
 * @program: api-gateway
 * @description:
 * @author: YuKai Fan
 * @create: 2025/2/6 10:39
 **/
public enum YesOrNoEnum {

    YES(1),
    NO(0),
    ;

    private final int code;

    YesOrNoEnum(int code) {
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public static YesOrNoEnum getByCode(int code) {
        for (YesOrNoEnum value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return NO;
    }

    public static Boolean convert(int code) {
        return code == 1;
    }
}
